home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 November / EnigmA AMIGA RUN 02 (1995)(G.R. Edizioni)(IT)[!][issue 1995-11][Skylink CD].iso / earcd / program / misc / blitscre.lha / blitterscreen / d.8.95.i < prev    next >
Text File  |  1980-01-14  |  5KB  |  301 lines

  1. * STANDARD STARTUP include
  2.  
  3. * $VER: d.i (22.6.95) still bugs when os-blitting active....
  4.  
  5. * ---------------
  6. clearcache MACRO
  7.    movem.l d0-d7/a0-a6,-(sp)
  8.    move.l 4,a6 : cmp.w #37,$14(a6) : bcs.s nokick2\@
  9.    jsr -636(a6) ;CacheClearU()
  10. nokick2\@:
  11.    movem.l (sp)+,d0-d7/a0-a6
  12.    ENDM
  13. waitblt MACRO
  14.    btst #6,$dff002 ;old blitters said to have bug...
  15. waitblt\@:
  16.    btst #6,$dff002
  17.    bne waitblt\@
  18.    ENDM
  19. waitvbl MACRO
  20.    move.w #$0020,$dff09c
  21. waitvbl\@:
  22.    btst #5,$dff01f
  23.    beq waitvbl\@
  24.    ENDM
  25.  
  26. waitrast MACRO
  27.    cmp.b \1,0        ;U maybe used no # calling waitrast ? :)
  28.    movem.l d0-d1/a0,-(sp)
  29.    lea $dff004,a0
  30. waitrast\@:
  31.    move.l (a0),d0
  32.    and.l #$1ff00,d0
  33.    move.l (a0),d1
  34.    move.l (a0),d1
  35.    move.l (a0),d1
  36.    move.l (a0),d1
  37.    and.l #$1ff00,d1
  38.    cmp.l d1,d0
  39.    bne.s waitrast\@
  40.    cmp.l \1,d0
  41.    bne.s waitrast\@
  42.    movem.l (sp)+,d0-d1/a0
  43.    ENDM
  44.  
  45. clrstruct MACRO
  46. structptr set 0
  47.    ENDM
  48. struct MACRO
  49. \1 set structptr
  50. structptr set structptr+\2
  51.    ifeq \2
  52.      WARNING! STRUCTLEN of \1 = 0!
  53.    endc
  54.    ENDM
  55.  
  56. fillb MACRO ;ADR NUM VAL ADD
  57.    add.b \2,filldummy ;trick: only immed/reg adressing allowed
  58.    movem.l d5/d6/d7/a6,-(sp)
  59.    move.l \1,a6
  60.    move.l \2,d7
  61.    move.b \3,d5
  62.    move.b \4,d6
  63. fill\@: move.b d5,(a6)+
  64.    add.l d6,d5
  65.    sub.l #1,d7
  66.    bne fill\@
  67.    movem.l (sp)+,d5/d6/d7/a6
  68.    ENDM
  69. fillw MACRO
  70.    add.b \2,filldummy
  71.    movem.l d5/d6/d7/a6,-(sp)
  72.    move.l \1,a6
  73.    move.l \2,d7
  74.    move.w \3,d5
  75.    move.w \4,d6
  76. fill\@: move.w d5,(a6)+
  77.    add.l d6,d5
  78.    sub.l #1,d7
  79.    bne fill\@
  80.    movem.l (sp)+,d5/d6/d7/a6
  81.    ENDM
  82. filll MACRO
  83.    add.b \2,filldummy
  84.    movem.l d5/d6/d7/a6,-(sp)
  85.    move.l \1,a6
  86.    move.l \2,d7
  87.    move.l \3,d5
  88.    move.l \4,d6
  89. fill\@: move.l d5,(a6)+
  90.    add.l d6,d5
  91.    sub.l #1,d7
  92.    bne fill\@
  93.    movem.l (sp)+,d5/d6/d7/a6
  94.    ENDM
  95.  
  96.    nop
  97.    bra start
  98.    rts ;for non-prec a68k-bug
  99. start:
  100.  
  101. * MEM
  102.    move.l #chip,d0
  103.    cmp.l #chipend,d0
  104.    bcs ret0
  105.    move.l #fast,d0
  106.    cmp.l #fastend,d0
  107.    bcs ret0
  108. ;chip
  109.    move.l 4,a6
  110.    move.l #chip+65536,d0
  111.    moveq #2,d1
  112.    jsr -198(a6)
  113.    move.l d0,chipmem0
  114.    beq ret0 ;chipmem0 nur fürs system
  115.    add.l #65536,d0
  116.    and.l #$ffff0000,d0 ;64k border wg. slow copper
  117.    move.l d0,chipmem
  118. ;fast
  119.    move.l 4,a6
  120.    move.l #fast+8192,d0 ;uhm 8k border for 040 caches :)
  121.    moveq #0,d1
  122.    jsr -198(a6)
  123.    move.l d0,fastmem0
  124.    beq ret1
  125.    add.l #8192,d0
  126.    and.l #-8192,d0
  127.    move.l d0,fastmem
  128.  
  129. * LIBS
  130.    move.l 4,a6
  131.    lea intname,a1
  132.    moveq #0,d0
  133.    jsr -552(a6) ;openlib
  134.    move.l d0,intuibase
  135.    beq ret2
  136.  
  137.    lea grafname,a1
  138.    moveq #0,d0
  139.    jsr -552(a6)
  140.    move.l d0,gfxbase
  141.    beq ret3
  142.  
  143. * Own blitter before changing vecs or copl
  144.    waitblt
  145.    move.l gfxbase,a6
  146.    jsr -456(a6) ;OWN Blitter
  147.  
  148. * INT: GETVBR
  149.    moveq #0,d0
  150.    move.l 4,a6
  151.    btst #0,$129(a6) ;flags...
  152.    beq.s storevbr
  153.    lea getvbr0(pc),a5
  154.    jsr -$1e(a6)  ;Supervisor()
  155.    bra.s storevbr
  156. getvbr0:
  157.    dc.l $4e7a0801 ;movec vbr,d0
  158.    rte
  159. _vbr dc.l 0
  160. storevbr:
  161.    move.l d0,_vbr
  162.  
  163. * INT3 VECTOR
  164.    move.l _vbr,a0
  165.    move.l $6c(a0),oldv ;!­!­! Lev3 VBL / BLTINT
  166.  
  167. * RESET SCREEN-HARDWARE
  168.    move.l gfxbase,a6
  169.    move.l $22(a6),oldviev
  170.    move.l #0,a1
  171.    jsr -222(a6) ;Loadview (0)
  172.  
  173.    move.w #25-1,d7
  174. nowaittof:
  175.    waitvbl
  176.    dbra d7,nowaittof
  177.  
  178.    move.w #$0020,$dff096
  179.    move.w #$81c0,$dff096
  180.  
  181. * CALL ----------------
  182.    bsr prg ;copl done by prg
  183. * END -----------------
  184. ret: ;from prg
  185. * INTVEC
  186.    move.w #$4000,$dff09a ;for the case still blt-ints running
  187.  
  188.    move.l _vbr,a0
  189.    move.l oldv,$6c(a0) ;!­!­! INT
  190.  
  191. * RESTORE SYSTEM-Screen
  192.    waitblt
  193.    waitblt
  194.    waitblt
  195.    move.w #$07fc,$dff09c ;kill hardwarehack-requests
  196.    move.w #$c000,$dff09a ;sys on for jsr's
  197.  
  198.    move.l gfxbase,a6
  199.    jsr -462(a6) ;DISOWN Blitter
  200.    move.l oldviev,a1
  201.    jsr -222(a6) ;LoadView(prev gb_ActiView)
  202.  
  203.    move.w #$0080,$dff096
  204.    move.l gfxbase,a0
  205.    move.l $26(a0),$dff080   ;gb_copinit => CopPtr
  206. ***   move.l $32(a0),$dff084 ;copl2 (?)
  207.  
  208.    move.w #0,$dff088
  209.    move.w #$81a0,$dff096
  210.  
  211.    move.l intuibase,a6
  212.    jsr -390(a6) ;Rethinkdisplay
  213.  
  214.    move.l gfxbase,a1
  215.    move.l 4,a6
  216.    jsr -414(a6) ;closelib
  217. ret3:
  218.    move.l intuibase,a1
  219.    move.l 4,a6
  220.    jsr -414(a6) ;closelib
  221. ret2:
  222.    move.l fastmem0,a1
  223.    move.l #fast+8192,d0
  224.    move.l 4,a6
  225.    jsr -210(a6)
  226. ret1:
  227.    move.l chipmem0,a1
  228.    move.l #chip+65536,d0
  229.    move.l 4,a6
  230.    jsr -210(a6)
  231. ret0:
  232.    clr.l d0
  233.    rts
  234. * ---
  235. d8 dc.l 0
  236. d9 dc.l 0
  237. d10 dc.l 0
  238. d11 dc.l 0
  239. d12 dc.l 0
  240. d13 dc.l 0
  241. d14 dc.l 0
  242. d15 dc.l 0
  243.  
  244. oldv dc.l 0
  245. oldviev dc.l 0
  246.  
  247. chipmem dc.l 0
  248. chipmem0 dc.l 0
  249. fastmem dc.l 0
  250. fastmem0 dc.l 0
  251.  
  252. filldummy dc.l 0
  253.  
  254. gfxbase dc.l 0
  255. intuibase dc.l 0
  256.  
  257. grafname dc.b 'graphics.library',0
  258. intname dc.b 'intuition.library',0
  259.    EVEN
  260.  
  261. * MAKECOP : $fffffffe,(a0)+ noch fällig !!!
  262. * copl a0 scr a1 planeoffs d0
  263. * COPLDATA a3! COPLLEN (ohne copl2puts) d1!
  264. * still pokes in copl2 of d.s BTW
  265.  
  266. maksimplecop:
  267.    movem.l d1,-(sp) ;!!
  268.  
  269.    move.l #copl2+2,a2
  270.    move.w #8-1,d7
  271.    move.l a1,d1
  272.    ext.l d0 ;offs .w
  273. maksimplecop0:
  274.    swap d1
  275.    move.w d1,(a2)
  276.    addq.w #4,a2
  277.    swap d1
  278.    move.w d1,(a2)
  279.    addq.w #4,a2
  280.    add.l d0,d1
  281.    dbra d7,maksimplecop0
  282.  
  283. ***   move.l #copl,a2
  284.    move.l a3,a2 ;NEW
  285.  
  286. ***   move.l #coplend-copl-1,d7  OLD: len is header without copl2 now!
  287.    movem.l (sp)+,d7 ;!! NEW
  288.    subq.w #1,d7
  289. maksimplecop1:
  290.    move.b (a2)+,(a0)+
  291.    dbra d7,maksimplecop1
  292.  
  293. ; cp updated copl2
  294.    lea copl2,a2
  295.    move.l #4*2*8-1,d7
  296. maksimplecop2:
  297.    move.b (a2)+,(a0)+
  298.    dbra d7,maksimplecop2
  299.    rts
  300.  
  301.